package com.py.credit.utils;

import java.util.Date;

import com.py.credit.entity.Table;

public enum NewBatchIdUtil {
	INSTANCE;
	public static NewBatchIdUtil getInstance() {
		return INSTANCE;
	}

	public String buildNewBatchId(int managerId, Table table) {
		// 随机4位数字
		StringBuilder batchId = new StringBuilder();
		batchId.append("EX-");
		batchId.append(table.getResourceId());
		batchId.append("-");
		batchId.append(managerId);
		batchId.append("-");
		batchId.append(DateUtil.getInstance().dateToStr(new Date(), DateUtil.YYYYMMDD));
		batchId.append("-");
		batchId.append((int) (Math.random() * 9000 + 1000));

		return batchId.toString();
	}
}
